package space.xxhui.javatts.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import space.xxhui.javatts.base.utils.ProjResponseUtils;
import space.xxhui.javatts.dto.TextToSpeechDto;
import space.xxhui.javatts.entity.ProjResponse;
import space.xxhui.javatts.service.TtsService;

import javax.validation.Valid;

/**
 * @author HitvzByHui
 * date 2021-03-28
 */
@RestController
@RequestMapping
public class TtsController {

    @Autowired
    private TtsService ttsService;

    @RequestMapping(value = "convert")
    public ProjResponse<String> textToSpeech(@Valid TextToSpeechDto dto) {
        return ProjResponseUtils.defaultSuccess(ttsService.convert(dto));
    }

}
